<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/8.0.20/jsrsasign-all-min.js"></script>

</head>

<body>
  <script>
//     var tNow = KJUR.jws.IntDate.get('now');
//     var tEnd = KJUR.jws.IntDate.get('now + 1day');
//     var teamId = 'SEARCHADS.xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
//     var keyId = 'xxxxxx-xxxx-xxxx-xxxxxxxxxxx';
//     var privateKey = `-----BEGIN EC PRIVATE KEY-----
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// -----END EC PRIVATE KEY-----`;

//     var oHeader = {
//       "alg": "ES256",
//       "kid": keyId
//     }

//     var oPayload = {
//       "iss": teamId,
//       "iat": tNow,
//       "exp": tEnd,
//       "aud": "https://appleid.apple.com",
//       "sub": 'clientId'
//     }

//     var sHeader = JSON.stringify(oHeader);
//     var sPayload = JSON.stringify(oPayload);

//     var sKey = KEYUTIL.getKey({ d: privateKey, curve: 'prime256v1' });
//     var sResult = KJUR.jws.JWS.sign('ES256', sHeader, sPayload, sKey);
//     console.log(`sResult ==>`,sResult);
  </script>
</body>

</html>